package controller.api;
import com.jfinal.aop.Before;
import com.jfinal.aop.Inject;
import com.jfinal.kit.Kv;

import common.inter.StaffStationInter;
import model.Calibration;
import service.CalibrationService;

public class ApiCalibrationController extends BaseApiController {
	@Inject CalibrationService calibrationService ;

	public void list() {
	    Kv kv = getParamKv() ;
	    Integer pageNumber = getParaToInt("pageNumber", 1);
	    Integer pageSize = getParaToInt("pageSize", 10);
	    set("page", calibrationService.getApiPage( kv , pageNumber, pageSize));
	    renderJson();
	}
	
	@Before(StaffStationInter.class)
	public void save() {
		Calibration calibration = getModel(Calibration.class,"",true);
		renderJson( calibrationService.save(calibration ,  getStaff() , getStation() ) );
	}
}
